This invention relates to a time-shared multitask execution device for time-shared processing of two or more tasks by using one central processing unit (CPU).
When executing task using a microprocessor, in a most common method, a set of register files consisting of a register group, stack pointers, status registers, etc. are prepared for one CPU, and the tasks are executed while transferring necessary data into the register files according to commands from the CPU. In this method, however, only one task can be executed at a time, and the execution efficiency is poor. Therefore, it has been hitherto considered to use a set of register files provided for one CPU in time-shared manner and to execute plural tasks in time shared manner. The most typical of these methods is to select one task after another at every command of the CPU. In this method, however, since two or more tasks are executed by selecting sequentially at every command, the priority order of the execution time of plural tasks cannot be determined. Still more, every time the tasks are selected, the data so far stored in the register data must be once stored in the memory (stack) region, and a processing step is needed to call the data necessary for the next task into the register files from other memory space or the like. During this data selection time, the task cannot be executed and hence the time loss is significant.
on the other hand, instead of such task selection at every command, a method of selecting tasks by interruption or other processing with a help of computer program in controlling the timing of plural tasks is also known. According to this method, it is also possible to determine the priority order of the execution time of plural tasks in advance when creating the program. For some type of program, however, it requires an advanced understanding about the program data in order to set the priority order, and it is very difficult to create an acceptable program for the user's specification and preset the priority order. In this case, too, since there is only one set of register files for one CPU, it is necessary to repeat data storing in calling for selecting the tasks, and the resultant time loss is not eliminated.
To solve the above problems, it has been proposed to prepare plural register files for one CPU, select a multiplexer according to a command from the CPU, and execute plural tasks in a time-shared manner while sequentially selecting the plural register files. In this way, since one register file is prepared for one task, it is not necessary to store or call the data when selecting tasks, and therefore the time loss is eliminated. In this case, again, selection setting of plural tasks and the priority order of execution of each task must be set by the program. It is a burden for the user to create a program according to the user's specification.
Thus, conventionally, in order to execute plural tasks by one CPU, it is required to set the selection schedule of tasks and priority order of execution time of each task in the program, such being a substantial burden for the user.